home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1833 / 1833.xpi / components / yoonoWebAPI.js < prev   
Text File  |  2009-12-16  |  2KB  |  74 lines

  1. const SERVICE_NAME = "Yoono Web API";
  2. const SERVICE_CID = Components.ID("{51b3c79b-aa74-4785-917d-c1f8a47e5210}");
  3. const SERVICE_CTRID = "@yoono.com/webapi;1";
  4.  
  5. const CC = Components.classes;
  6. const CI = Components.interfaces;
  7.  
  8. Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
  9.  
  10. //class constructor
  11. function YoonoWebAPI() {
  12.   var extId = '{d9284e50-81fc-11da-a72b-0800200c9a66}';
  13.   var extmgr = Components.classes['@mozilla.org/extensions/manager;1'].getService(Components.interfaces.nsIExtensionManager);
  14.   this.version = extmgr.getItemForID(extId).version;
  15. }
  16.  
  17. // class definition
  18. YoonoWebAPI.prototype = {
  19.   classDescription: SERVICE_NAME,
  20.   classID: SERVICE_CID,
  21.   contractID: SERVICE_CTRID,
  22.  
  23.   _xpcom_categories: [{
  24.     category: "JavaScript global property",
  25.     entry: "yoonoapi",
  26.     value: SERVICE_CTRID
  27.   }],
  28.  
  29.   QueryInterface: XPCOMUtils.generateQI([CI.nsISecurityCheckedComponent,
  30.                                          CI.yoonoIWebAPI,
  31.                                          CI.nsIClassInfo]),
  32.  
  33.   // nsIClassInfo
  34.  
  35.   getInterfaces: function(aCount) {
  36.     var result = [CI.nsISecurityCheckedComponent,
  37.                   CI.yoonoIWebAPI,
  38.                   CI.nsIClassInfo];
  39.     aCount.value = result.length;
  40.     return result;
  41.   },
  42.  
  43.   getHelperForLanguage: function(aLanguage) {
  44.     return null;
  45.   },
  46.  
  47.   // nsISecurityCheckedComponent
  48.  
  49.   canCreateWrapper: function(aIID) {
  50.     return "AllAccess";
  51.   },
  52.  
  53.   canCallMethod: function(aIID, methodName) {
  54.     return "NoAccess";
  55.   },
  56.  
  57.   canGetProperty: function(aIID, propertyName) {
  58.     switch (propertyName) {
  59.       case "version":
  60.         return "AllAccess";
  61.     }
  62.     return "NoAccess";
  63.   },
  64.  
  65.   canSetProperty: function(aIID, propertyName) {
  66.     return "NoAccess";
  67.   }
  68. };
  69.  
  70. var components = [YoonoWebAPI];
  71. function NSGetModule(compMgr, fileSpec) {
  72.   return XPCOMUtils.generateModule(components);
  73. }
  74.